package com.kingmed.kmss.common.exception.bpmn;

import com.kingmed.kmss.common.utils.MessageUtils;

/**
 * 工作流异常-无法启动流程
 */
public class ProcessSubmittedException extends RuntimeException {

    /**
	 * 
	 */
	private static final long serialVersionUID = 6181218841918960392L;

	/**
     * 错误码
     */
    private Integer code;

    /**
     * 错误提示
     */
    private String message;

    /**
     * 错误明细，内部调试错误
     */
    private String detailMessage;

    /**
     * 空构造方法，避免反序列化问题
     */
    public ProcessSubmittedException() {
    	this.message = MessageUtils.message("bpmn.processAlreadyStarted");
    }

    public ProcessSubmittedException(String format, Object... args) {
    	String msg = String.format(format, args);
        this.message = msg;
    }

    public ProcessSubmittedException(String message) {
        this.message = message;
    }
    
    public ProcessSubmittedException(String message, Integer code) {
        this.message = message;
        this.code = code;
    }

    public String getDetailMessage() {
        return detailMessage;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public Integer getCode() {
        return code;
    }

    public ProcessSubmittedException setMessage(String message) {
        this.message = message;
        return this;
    }

    public ProcessSubmittedException setDetailMessage(String detailMessage) {
        this.detailMessage = detailMessage;
        return this;
    }
}

